using System;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.Serialization;

namespace Bookvar.ObjectModel
{
    /// <summary>
    /// A simple comment from the user.
    /// </summary>
    [DataContract]
    [Serializable]
    public class Annotation
    {
        [DataMember(Name = "ID")]
        private readonly Guid id;
        private string text;
        private DateTime date;

        [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "ID")]
        public Guid ID
        {
            get { return id; }
        }

        [DataMember]
        public DateTime Date
        {
            get { return date; }
            set { date = value; }
        }

        [DataMember]
        public string Text
        {
            get { return text; }
            set { text = value; }
        }

        public Annotation(string text, DateTime date)
        {
            this.text = text;
            this.date = date;
        }

        public Annotation() : this(Guid.NewGuid(), string.Empty, DateTime.Now)
        {

        }

        public Annotation(string text) : this(text, DateTime.Now)
        {
        }

        public Annotation( Guid id, string text, DateTime date )
        {
            this.date = date;
            this.id = id;
            this.text = text;
        }
    }
}
